package com.zryc.service;

import com.zryc.shop.entity.Product;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ProductServiceFallBack implements ProductServiceClient{

    @Override
    public Product getProd(Integer pid) {
        //假如由于某种原因访问商品阢失败了，就会默认调用执行这个方法，返回一个默认值
        Product product=new Product();
        product.setPid(-1);//设置一个
        return product;
    }

    @Override
    public void reduceInventory(Integer pid, Integer num) {
        log.error("{}","扣库存出错");
    }
}
